% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/country_date.R
\name{locf}
\alias{locf}
\title{Front-fill an object}
\usage{
locf(x)
}
\arguments{
\item{x}{Object to front fill.}
}
\description{
S3 generic function that front-fills by carrying the last
observation forward. For DataFrames and Matrices, this is done
column-wise.
}
\examples{
v <- c(NA, 1, NA, 2, 2)
locf(v)

df <- data.frame(x = c(1, NA, NA))
(out <- locf(df))

# The original object should be preserved
identical(df, out)

m <- matrix(1:6, 3, 2)
m[1, 2] <- NA

# This should still be identical to m
locf(m)

}
\seealso{
Other fill functions: \code{\link{interpolate}},
  \code{\link{stretch}}
}
\concept{fill functions}
